# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-truststore
pkgver=0.10.0
pkgrel=0
pkgdesc="Verify certificates using OS trust stores"
url="https://github.com/sethmlarson/truststore"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-installer py3-flit-core"
checkdepends="
	py3-aiohttp
	py3-flaky
	py3-httpx
	py3-openssl
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-httpserver
	py3-requests
	py3-trustme
	py3-urllib3
"
subpackages="$pkgname-pyc"
source="https://github.com/sethmlarson/truststore/archive/v$pkgver/py3-truststore-$pkgver.tar.gz"
builddir="$srcdir/truststore-$pkgver"
options="net" # checks on example.com for some reason

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	case "$CARCH" in
	loongarch64)
		.testenv/bin/python3 -m pytest \
		--deselect tests/test_api.py::test_success \
		--deselect tests/test_api.py::test_success_after_loading_additional_anchors \
		--deselect tests/test_api.py::test_sslcontext_api_success_async \
		--deselect tests/test_inject.py::test_success_with_inject
		;;
	*)
		.testenv/bin/python3 -m pytest
		;;
	esac
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
eb1b16f093f32ff8be29bb696e92843823a8ffe2e7428ea989ee987d94d7328b5c40d6d8e5aa25eb223ca348ca30b29018decaec11d6106221753fd4525aa5b0  py3-truststore-0.10.0.tar.gz
"
